package com.zzyl.controller.customer;

import com.zzyl.base.PageResponse;
import com.zzyl.base.ResponseResult;
import com.zzyl.service.NursingProjectService;
import com.zzyl.vo.NursingProjectVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/customer")
@Slf4j
@Api(tags = "客户端：护理项目")
public class CustomerNursingProjectController {

    @Autowired
    private NursingProjectService nursingProjectService;

    @GetMapping("/orders/project/page")
    @ApiOperation("客户端：分页查询护理项目")
    public ResponseResult<PageResponse<NursingProjectVo>> searchCustomerByPage(@ApiParam("护理项目名称") String name,
                                                                               @ApiParam("页码") @RequestParam(defaultValue = "1") Integer pageNum,
                                                                               @ApiParam("每页展示数") @RequestParam(defaultValue = "10") Integer pageSize,
                                                                               @ApiParam("状态 0:禁止 1:启用")Integer status){
        PageResponse<NursingProjectVo> page = nursingProjectService.searchCustomerByPage(pageNum,pageSize,name,status);

        return ResponseResult.success(page);
    }

    @GetMapping("/orders/project/{id}")
    @ApiOperation("客户端：根据id查询护理项目")
    public ResponseResult<NursingProjectVo> searchCustomerById(@ApiParam("id") @PathVariable Long id){

        NursingProjectVo nursingProjectVo = nursingProjectService.searchCustomerById(id);

        System.out.println(nursingProjectVo);
        return ResponseResult.success(nursingProjectVo);
    }
}
